<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}

    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">

    <link rel="stylesheet" href="__STATIC_URL__/static/css/setcard.css"/>


    <script src="__STATIC_URL__/static/js/setcard.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/giftcreat.js?v=5"></script>

</head>
<body id="body">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <ol class="breadcrumb">
            <li>当前位置是&nbsp;:</li>
            <li>
                <a href="#">礼品卡</a>
            </li>
            <li class="active" style="color: #02b87f;">查看礼品卡</li>
        </ol>
        <!--创建会员卡主要内容-->
        <div class="card-content clearfix">
            <div class="pull-left card-left" style="min-height: 582px;">
                <div class="cardL-body">
                    <div class="cardL-title"
                         style="background: #000 url(/assets/merchant/image/APPtop.png) no-repeat center top;"></div>
                    <div style="padding: 15px;">
                        <div class="card" id="cards"
                             style="background-image: url(__STATIC_URL__/static/images/cover1.png);background-position: left top;background-repeat: repeat;background-size: cover;">
                            <div class="cardL-top">
                                <div class="cardL-logo-wrap pull-left">
                                    <div style="background-size: cover;background-position:left top;"
                                         class="cardL-logo logopic" id="cardL-logo"></div>
                                </div>
                                <div class="pull-left">
                                    <div class="cardL-name brand_name">商户名称</div>
                                    <div class="cardL-name brand_title">礼品卡名称</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--<div class="cardL-type">-->
                    <!--<div class="card_custom_field left-jifen">-->
                        <!--<span class="r-title">积分</span>-->
                        <!--<span class="r-describe" style="color: rgb(53, 164, 222);">0</span>-->
                    <!--</div>-->

                <!--</div>-->
                <div class="quick_pay ng-scope member-card-editable-container  left-tabs" id="pay-weixin">
                    <a href="javascript:;" class="r-btn ng-binding centerbt centerbt-bt" style="color: rgb(53, 164, 222); border-color: rgb(53, 164, 222); ">
                         未填写
                    </a>
                    <div style="font-size: 12px;margin-top: 4px;color:#7d7d7d;"
                         class="centerfbt ng-binding ng-scope center-title centerfbt-bt">
                    </div>
                </div>
                <div class="r-cell s-first" id="card-self-tab">
                    <ul>

                        <!--<li class="member-card-editable-container left-tabs recharge"-->
                            <!--onclick="tabsigleshow('settings','recharge')">-->
                            <!--<span class="ng-binding self-0-bt cell1-bt cell1">自定义入口</span>-->
                            <!--<span class="r-tip  self-0-lfbt tit1-bt tit1">未使用</span>-->
                        <!--</li>-->
                        <!--<li class="member-card-editable-container left-tabs integral"-->
                            <!--onclick="tabsigleshow('settings','integral')">-->
                            <!--<span class="ng-binding self-1-bt cell2-bt cell2">自定义入口1</span>-->
                            <!--<span class="r-tip  self-1-lfbt tit2-bt tit2">未使用</span>-->
                        <!--</li>-->
                        <!--<li class="member-card-editable-container left-tabs marketing"-->
                            <!--onclick="tabsigleshow('settings','marketing')">-->
                            <!--<span class="ng-binding self-2-bt cell3-bt cell3">营销入口</span>-->
                            <!--<span class="r-tip ng-binding self-2-lfbt tit3-bt tit3">未使用</span>-->
                        <!--</li>-->
                        <li class="member-card-editable-container left-tabs recommend"
                            onclick="tabsigleshow('settings','recommend')">
                            <span class="ng-binding self-3-bt cell4-bt cell4">营销入口</span>
                            <span class="r-tip ng-binding self-3-lfbt tit4-bt tit4">未使用</span>
                        </li>
                        <li class="member-card-editable-container memberDetail carddetail left-tabs" onclick="tabsigleshow('carddetail','memberDetail')">
                            <span>礼品卡详情</span>
                        </li>
                        <!--<li class="member-card-editable-container applyMall carddetail left-tabs" onclick="tabsigleshow('carddetail','applyMall')"><span>适用门店</span></li>-->
                        <li><span>公众号</span></li>
                    </ul>
                </div>
            </div>
            <div class="cardR-right">
                <div style="width: 100%;">
                    <!-- TAB导航 -->
                    <ul class="nav nav-tabs" role="tablist" id="myTabs">
                        <!--<li role="presentation" class="active">-->
                            <!--<a href="#home" aria-controls="home" role="tab" data-toggle="tab">基本信息</a>-->
                        <!--</li>-->
                        <li role="presentation">
                            <a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">中心按钮</a>
                        </li>
                        <li role="presentation">
                            <a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">自定义/营销入口</a>
                        </li>

                        <li role="presentation" class="active">
                            <a href="#carddetail" aria-controls="carddetail" role="tab" data-toggle="tab">礼品卡详情</a>
                        </li>
                    </ul>
                    <!-- Tab 内容 -->
                    <div class="panel panel-default" style="margin-top: 15px;">
                        <form class="form-horizontal" action="" method="post" id="creatcards">
                            <div class="tab-content">
                                <!--基本信息-->
                                <div role="tabpanel" class="tab-pane" id="home">
                                    <div class="panel-heading">基本信息</div>
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <input type="hidden" id="card_id" value="{$info['card_id']}" name="card_id">
                                            <label class="col-sm-2 control-label">卡券封面：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <select class="form-control" id="cover" disabled="disabled">
                                                    <option value="1">图片</option>
                                                    <option value="2">颜色</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"></label>
                                            <div class="col-sm-10">
                                                <div class="show cover" id="pic_url" >
                                                    <div class="r-desc ng-scope" >请参照
                                                        <a style="color: #2db7f5;display: inline-block;font-size: 14px;"
                                                           href="https://mp.weixin.qq.com/cgi-bin/readtemplate?t=cardticket/card_cover_tmpl&amp;type=info&amp;lang=zh_CN"
                                                           title="" target="_blank">图片规范</a> 上传   建议1000*600像素 格式为.jpg
                                                    </div>
                                                    <div class="ng-scope" style="position: relative;" >
                                                        <span class="btn btn-default">上传礼品卡图片</span><span class="mgl15 text-danger">若须更换背景图，请选择上传背景图   </span>
                                                        <input type="file" id="card" value="" onchange="upload('card', 'file')" disabled="disabled"/>
                                                        <input type="hidden" name="background_pic_url" id="card-upload"value="" disabled="disabled">
                                                    </div>
                                                </div>
                                                <div class="cover hide" id="colors">
                                                    <input type="hidden" name="base[color]" value="$info['color']" id="color">
                                                    <ul class="color-list clearfix">
                                                        <li {if condition="$info['color'] eq '#63b359'"} class="selected" {/if} style="background-color:#63b359;" data-color="#63b359"></li>
                                                        <li {if condition="$info['color'] eq '#2c9f67'"} class="selected" {/if} style="background-color:#2c9f67;" data-color="#2c9f67"></li>
                                                        <li {if condition="$info['color'] eq '#509fc9'"} class="selected" {/if} style="background-color:#509fc9;" data-color="#509fc9"></li>
                                                        <li {if condition="$info['color'] eq '#5885cf'"} class="selected" {/if} style="background-color:#5885cf;" data-color="#5885cf"></li>
                                                        <li {if condition="$info['color'] eq '#9062c0'"} class="selected" {/if} style="background-color:#9062c0;" data-color="#9062c0"></li>
                                                        <li {if condition="$info['color'] eq '#d09a45'"} class="selected" {/if} style="background-color:#d09a45;" data-color="#d09a45"></li>
                                                        <li {if condition="$info['color'] eq '#e4b138'"} class="selected" {/if} style="background-color:#e4b138;" data-color="#e4b138"></li>
                                                        <li {if condition="$info['color'] eq '#ee903c'"} class="selected" {/if} style="background-color:#ee903c;" data-color="#ee903c"></li>
                                                        <li {if condition="$info['color'] eq '#f08500'"} class="selected" {/if} style="background-color:#f08500;" data-color="#f08500"></li>
                                                        <li {if condition="$info['color'] eq '#a9d92d'"} class="selected" {/if} style="background-color:#a9d92d;" data-color="#a9d92d"></li>
                                                        <li {if condition="$info['color'] eq '#dd6549'"} class="selected" {/if} style="background-color:#dd6549;" data-color="#dd6549"></li>
                                                        <li {if condition="$info['color'] eq '#cc463d'"} class="selected" {/if} style="background-color:#cc463d;" data-color="#cc463d"></li>
                                                        <li {if condition="$info['color'] eq '#cf3e36'"} class="selected" {/if} style="background-color:#cf3e36;" data-color="#cf3e36"></li>
                                                        <li {if condition="$info['color'] eq '#5E6671'"} class="selected" {/if} style="background-color:#5E6671" data-color="#5E6671"></li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">商户名称：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="hidden" name="mid" value="">
                                                <input type="text" disabled="disabled" name="base[brand_name]" id="brand_name"
                                                       class="form-control" oninput="binding('brand_name')"  onchange="tex('brand_name','titletext','12');"/>
                                                <div class="help-block" id="titletext"></div>
                                                <div class="r-desc ng-binding ng-scope">建议商户名或服务内容，如**礼品卡 字数上限为12个字符。</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">礼品卡标题：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[title]" class="form-control"
                                                       disabled="disabled"  id="brand_title" oninput="binding('brand_title')" onchange="tex('brand_title','brandtext','9');"/>
                                                <div class="help-block" id="brandtext"></div>
                                                <div class="r-desc ng-binding ng-scope">建议礼品卡标题包含商户名或服务内容，如**礼品卡 字数上限为9个字符。</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">LOGO：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <div class="ng-scope" style="position: relative;">
                                                    <span class="btn btn-default">上传LOGO</span>
                                                    <input type="file" disabled="disabled" id="logopic" value=""  onchange="upload('logopic', 'file')"/>
                                                    <input type="hidden" disabled="disabled" name="base[logo_url]" id="logopic-upload" value="{$moinfo['img_wx']}" >
                                                </div>
                                                <img src='__STATIC_URL__/static/images/LOGO.png' alt="" class="logopic-img" id="logopic-img" style="margin-top: 10px;width: 100px;height: 100px;border: none;display: block;"/>
                                                <div class="r-desc ng-binding ng-scope">建议300*300像素 格式为.jpg</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">code展示类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <select name="base[code_type]" disabled="disabled"
                                                        class="selectpicker form-control ng-valid ng-scope ng-not-empty ng-dirty ng-valid-parse ng-touched"
                                                        style="" id="code_type">
                                                    <option label="文本" value="CODE_TYPE_TEXT">文本</option>
                                                    <option label="一维码" value="CODE_TYPE_BARCODE">一维码</option>
                                                    <option label="二维码" value="CODE_TYPE_QRCODE" selected="selected">
                                                        二维码
                                                    </option>
                                                    <option label="仅显示二维码" value="CODE_TYPE_ONLY_QRCODE">仅显示二维码</option>
                                                    <option label="仅显示一维码" value="CODE_TYPE_ONLY_BARCODE">仅显示一维码
                                                    </option>
                                                    <option label="不显示任何码型" value="CODE_TYPE_NONE">不显示任何码型</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">创建库存数量：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[sku][quantity]" class="form-control" id="kucun" disabled="disabled"/>
                                                <input type="hidden" name="activate" value="0" >
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">礼品卡价格：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[price]" class="form-control"
                                                       id="price" disabled="disabled"/>
                                                <div class="help-block" id="pricetext"></div>
                                                <div class="r-desc ng-binding ng-scope"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">最大可赠送次数：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[max_give_friend_times]" class="form-control"
                                                       id="max_give_friend_times" value="1" disabled="disabled"/>
                                                <div class="help-block" id="max_give_friend_timestext"></div>
                                                <div class="r-desc ng-binding ng-scope"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">期限类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-3 col-xs-6 coupon-color">
                                                <select class="form-control" name="base[date_info][type]"  id="date_info" disabled="disabled">
                                                    <option value="DATE_TYPE_FIX_TIME_RANGE">自定义有效时间</option>
                                                    <option value="DATE_TYPE_FIX_TERM" id="dis">领取有效时间</option>
                                                    <option value="DATE_TYPE_PERMANENT" id="">永久有效</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group cover1">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">选择时间：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" disabled="disabled" name="base[date_info][times]" class="form-control" value="" placeholder="请选择开始时间" readonly="readonly" id="starttime">
                                                <div class="r-message text-danger"></div>
                                            </div>
                                        </div>
                                        <div class="form-group cover2 hide">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">选择天数：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-3 col-xs-6 coupon-color">
                                                <input type="text" class="form-control pull-left" disabled="disabled"  name='base[date_info][fixed_term]' style="width:80%;"  placeholder="选择天数" id="fixed_term">
                                                <span class="pull-left" style="padding-top:4px">天</span>
                                            </div>

                                        </div>




                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">积分：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="supply_bonus" value="1" disabled="disabled"
                                                               type="radio" style="margin-left: 0;">
														<label class="ng-binding">启用</label>
													</span>
                                                <span class="radio pull-left">
														<input name="supply_bonus" value="2" type="radio"
                                                               disabled="disabled"   style="margin-left: 0;">
														<label class="ng-binding">不启用</label>
													</span>
                                            </div>
                                        </div>
                                        <input name="supply_balance" value="0" type="hidden">
                                    </div>
                                </div>

                                <div role="tabpanel" class="tab-pane" id="messages">
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">按钮</label>
                                            <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="base[is_center]" checked="checked" value="1" type="radio"
                                                               disabled="disabled"  style="margin-left: 0;">
														<label class="ng-binding">显示</label>
													</span>
                                                <span class="radio pull-left">
														<input name="base[is_center]" type="radio" value="2"
                                                               disabled="disabled"    style="margin-left: 0;">
														<label class="ng-binding">不显示</label>
													</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">跳转类型：</label>
                                            <div class="col-sm-10">
                                                <select name="is_center_url_type" class="form-control " style="" id="tzs" onChange="tz(this,'swithtypexcx','view','xcxurl','text');">
                                                    <option  value="wxurl">跳转网页</option>
                                                    <option  value="wxxcx">跳转小程序</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div id="view">
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label ng-binding">标题：</label>
                                                <div class="col-sm-10">
                                                    <input type="text" disabled="disabled" class="form-control swithtype swithtype-bt centerbt-bt centerbt" readonly="readonly" name="base[center_title]" id="centerbt" value="" placeholder=""/>
                                                </div>
                                            </div>
                                            <div class="form-group" id="sub" style="">
                                                <label class="col-sm-2 control-label ng-binding">副标题：</label>
                                                <div class="col-sm-10">
                                                    <input type="text " disabled="disabled" class="form-control swithtype swithtype-fbt" name="base[center_sub_title]" id="centerfbt" value="" placeholder="" oninput="showtitl('centerfbt',this);" onchange="text('centerfbt','','16');" />
                                                    <div class="r-desc ng-binding ng-scope">字段长度限制为16个字符，中文2个字符，数字，字母1个字符。</div>

                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="swithtypexcx">

                                            <label class="col-sm-2 control-label ng-binding">小程序原始ID：</label>
                                            <div class="col-sm-10">
                                                <input type="text" disabled="disabled" value="" name="base[center_app_brand_user_name]" class="form-control" placeholder="请输入小程序原始ID"  id="cxcxapptext" >
                                                <div class="help-block" id=""></div>

                                            </div>

                                            <label class="col-sm-2 control-label ng-binding">小程序路径：</label>
                                            <div class="col-sm-10">
                                                <input type="text" disabled="disabled" value="" class="form-control" name="base[center_app_brand_pass]" placeholder="请输入小程序路径" id="cnametext"  >
                                                <div class="help-block" id=""></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding" id="tex">链接：</label>
                                            <div class="col-sm-10">
                                                <input type="text" disabled="disabled" class="form-control swithtype swithtype-url" readonly="readonly" name="base[center_url]" id="center_url" value="" placeholder=""/>
                                                <div class="help-block" id="text"></div>

                                            </div>
                                        </div>


                                    </div>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="settings">
                                    <div class="panel-body">

                                        <div class="panel panel-default" id="recommend">
                                            <div class="panel-heading">营销入口
                                                <div class="pull-right">
                                                    <input type="hidden" name="base[is_custom]" id="self-ipt-3" value="2">
                                                    <a class="ng-scope" href="javascript:;" data-type="3"
                                                       data-name="自定义入口1" id="ng-scope5">已关闭</a>
                                                </div>
                                            </div>
                                            <div class="panel-body" style="padding:30px;">
                                                <div class="form-group">
                                                    <label class="font400">跳转类型：</label>
                                                    <div class="col-sm-12">
                                                        <select name="is_custom_url_type" class="form-control " style="" id="is_custom_url" onChange="tz(this,'self-3xcx','views','xcxurls','texts');">
                                                            <option  value="wxurl">跳转网页</option>
                                                            <option  value="wxxcx">跳转小程序</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div  id="views">
                                                    <div class="form-group">
                                                        <label class="font400">标题：</label>
                                                        <input type="text" disabled="disabled" class="form-control self-3-fbt" id="self-3"  placeholder="请输入标题" >

                                                        <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>

                                                        <input type="hidden" value="" disabled="disabled" class="form-control" placeholder="请输入标题" id="cell4" style="margin-top: 10px;" name="base[custom_url_name]"  oninput="showinput(this.id,this);" onchange="tex('cell4','cell4text','5');">
                                                        <div class="help-block" id="cell4text"></div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="font400">副标题：</label>
                                                        <input type="text" name="base[custom_url_sub_title]" disabled="disabled" class="form-control self-3-fbt" id="tit4"  placeholder="请输入副标题" oninput="showtitl(this.id,this);" onchange="text('tit4','tit4text','12');">
                                                        <div class="help-block" id="tit4text"></div>
                                                        <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>

                                                    </div>
                                                </div>
                                                <div class="form-group " id="self-3xcx" >



                                                    <label class="font400">小程序原始ID：</label>

                                                    <input type="text"  value="" disabled="disabled" name="custom_cell4[app_brand_user_name]" class="form-control" placeholder="请输入小程序原始ID"  id="app_brand_user_name4" >
                                                    <div class="help-block" id=""></div>



                                                    <label class="font400">小程序路径：</label>

                                                    <input type="text"  value="" disabled="disabled" class="form-control" name="custom_cell4[app_brand_pass]" placeholder="请输入小程序路径" id="app_brand_pass4"  >
                                                    <div class="help-block" id=""></div>

                                                </div>
                                                <div class="form-group">
                                                    <label class="font400">链接：</label>
                                                    <input type="text" name="base[custom_url]" disabled="disabled" class="form-control self-3-url" readonly="readonly" placeholder="" id="self-3-url">
                                                    <div class="help-block" id="texts"></div>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div role="tabpanel" class="tab-pane  active" id="carddetail">
                                    <div class="panel-body">


                                        <div class="panel panel-default" id="memberDetail">
                                            <div class="panel-heading">礼品卡详情</div>
                                            <div class="panel-body">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">特权说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <textarea name="prerogative" id="prerogative" disabled="disabled" rows="4" cols="" class="form-control" placeholder="例如：用卡可享受8.8折扣" style="resize: none;" ></textarea>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">使用说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <textarea name="base[description]"  disabled="disabled" id="description" rows="4" class="form-control"
                                                                  style="resize: none;"  placeholder="请认真填写" ></textarea>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">电话：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <input type="text" disabled="disabled" class="form-control" id="service_phone" name="base[service_phone]" placeholder="请认真填写" value=""/>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">使用提醒：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <input name="base[notice]" disabled="disabled" class="form-control" maxlength="16" id="notice" style="resize: none;"  placeholder="请认真填写" onchange="tex('notice','noticetext','16');">
                                                        <div class="help-block" id="noticetext"></div>
                                                        <div class="r-desc ng-binding ng-scope">建议引导用户到店出示礼品卡，由店员完成核销操作。(请保持16个汉字之内)</div>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--<div class="panel-footer">-->
                                <!--<button type="button"  id="creatcards-btn" class="btn btn-success">保存</button>-->
                            <!--</div>-->
                        </form>

                    </div>
                </div>
            </div>
        </div>

        {include file='public/footer'/}
        <!--获取门店列表-->
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document" style="width: 800px;">
                <div class="modal-content">
                    <div class="modal-header" style="background: #F4F5F9;">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="modal-title" id="myModalLabel">选择门店</h4>
                    </div>
                    <div class="modal-body">
                        <div class="panel panel-default panel-modal" style="border: 0;">
                            <div class="panel-heading"
                                 style="overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-bottom: 0;">
                                <div class="checkbox pull-left">
                                    <label>
                                        <!--<input type="checkbox" id="allchoice"> 门店名称-->
                                        门店名称
                                    </label>
                                </div>
                                <div class="checkbox pull-right" style="margin-top: 10px;">
                                    <label>地址</label>
                                </div>
                            </div>
                            <div class="panel-body" style="padding: 0;">

                                <table class="table table-bordered">
                                    <tbody id="tbody"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer"
                         style="text-align: center;overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-top: 0;">
                        <button type="button" class="btn btn-success" id="choiceComplate">完成</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script>


    $('input:radio[name="supply_bonus"]').change(function(){
        if($(this).is(":checked")){
            if($(this).val()=='1'){
                $(".cardL-type").attr("style","display:flex");

            }else{
                $(".cardL-type").attr("style","display:none");

            }
        }
    });
</script>
<script>
    $(function () {
        var url= "{:url('cardgifts/getcardgiftinfo')}";
        var card_id=$("#card_id").val();
        $.ajax({
            url:url,
            type:"post",
            data:{
                card_id:card_id
            },
            success:function(data) {
                 console.log(111,data);
                if (data.code == 0) {
                    var color=data.data.color;//颜色
                    var pic_url=data.data.pic_url;//背景图
                    var brand_name=data.data.base_info.brand_name;//商户名称
                    var title=data.data.title;//礼品卡标题
                    var logo_url=data.data.logo_url;//LOGO
                    var code_type=data.data.base_info.code_type;//code展示类型
                    var quantity=data.data.base_info.sku.quantity;//创建库存数量
                    var price=data.data.price;//礼品卡价格
                    var max_give_friend_times=data.data.base_info.max_give_friend_times;//最大可赠送次数
                    var type=data.data.base_info.date_info.type;//期限类型
                    var fixed_term=data.data.base_info.date_info.fixed_term;//领取有效时间
                    var supply_bonus=data.data.supply_bonus;//积分
                    var fixed_term=data.data.base_info.date_info.fixed_term;//领取有效时间
                    var times=data.data.times;
                    /*中心按钮*/
                    var is_center=data.data.is_center;//中心按钮显示
                    var center=data.data.center;
                    /*自定义/营销入口*/
                    var is_custom=data.data.is_custom;//中心按钮显示
                    var custom_cell1=data.data.custom_cell1;
                    /*礼品卡详情**/
                    var is_locations=data.data.is_locations;//适用门店
                    var prerogative=data.data.prerogative;//特权说明
                    var description=data.data.base_info.description;//使用说明
                    var service_phone=data.data.base_info.service_phone;//电话
                    var notice=data.data.base_info.notice;//使用提醒
                    var is_center_url_type=data.data.is_center_url_type;//
                    var is_custom_url_type=data.data.is_custom_url_type;//
                    /*************/
                    if(is_center_url_type=="wxxcx"){
                        $("#swithtypexcx").attr("style","display:block");
                        $("#view").attr("style","display:none");
                        $("#tex").html("备用网页");
                        $("#text").html("旧版微信客户端无法支持小程序，用户点击菜单时将会打开备用网页。");
                    }else{
                        $("#swithtypexcx").attr("style","display:none");
                        $("#view").attr("style","display:block");
                        $("#self-3-url").html("链接");
                        $("#text").html("");
                    }
                    if(is_custom_url_type=="wxxcx"){
                        $("#self-3xcx").attr("style","display:block");
                        $("#views").attr("style","display:none");
                        $("#self-3-url").html("备用网页");
                        $("#texts").html("旧版微信客户端无法支持小程序，用户点击菜单时将会打开备用网页。");
                    }else{
                        $("#self-3xcx").attr("style","display:none");
                        $("#views").attr("style","display:block");
                        $("#texs").html("链接");
                        $("#texts").html("");
                    }
                    if(pic_url==""){
                        $("#cover").val("2")
                        $("#colors").addClass("show").removeClass("hide");
                        $("#pic_url").addClass("hide").removeClass("show");
                        $("#color").val(color);
                        // console.log(333,color);
                        $("#cards").css("background-color",color)
                    }else{
                        $("#cover").val("1")
                        $("#pic_url").addClass("show").removeClass("hide");
                        $("#colors").addClass("hide").removeClass("show");
                        $("#cards").css("background-image","url("+pic_url+")")
                    }
                    $("#brand_name").val(brand_name);
                    $(".brand_name").html(brand_name);
                    $("#brand_title").val(title);
                    $(".brand_title").html(title);
                    $("#logopic-upload").val(logo_url);
                    $("#logopic-img").attr("src",logo_url);
                    $("#cardL-logo").css("background-image","url("+logo_url+")");
                   if(code_type=="CODE_TYPE_TEXT"){
                       $("#code_type").val("CODE_TYPE_TEXT")
                   }
                    if(code_type=="CODE_TYPE_BARCODE"){
                        $("#code_type").val("CODE_TYPE_BARCODE")
                    }
                    if(code_type=="CODE_TYPE_QRCODE"){
                        $("#code_type").val("CODE_TYPE_QRCODE")
                    }if(code_type=="CODE_TYPE_ONLY_QRCODE"){
                        $("#code_type").val("CODE_TYPE_ONLY_QRCODE")
                    }if(code_type=="CODE_TYPE_ONLY_BARCODE"){
                        $("#code_type").val("CODE_TYPE_ONLY_BARCODE")
                    }if(code_type=="CODE_TYPE_NONE"){
                        $("#code_type").val("CODE_TYPE_NONE")
                    }

                    $("#kucun").val(quantity);
                    $("#price").val(price);
                    $("#max_give_friend_times").val(max_give_friend_times);
                    if(type=="DATE_TYPE_FIX_TIME_RANGE"){
                        $(".cover1").addClass("show").removeClass("hide");
                        $(".cover2").addClass("hide").removeClass("show");
                        $("#starttime").val(times);
                        $("#date_info").val("DATE_TYPE_FIX_TIME_RANGE")
                    }else if(type=="DATE_TYPE_FIX_TERM"){
                        $("#date_info").val("DATE_TYPE_FIX_TERM")
                        $(".cover1").addClass("hide").removeClass("show");
                        $(".cover2").addClass("show").removeClass("hide");
                        $("#fixed_term").val(fixed_term);
                    }else if(type=="DATE_TYPE_PERMANENT"){
                        $("#date_info").val("DATE_TYPE_PERMANENT")
                        $(".cover1").addClass("hide").removeClass("show");
                        $(".cover2").addClass("hide").removeClass("show");
                    }
                    if(supply_bonus=='1'){
                        $(".cardL-type").attr("style","display:flex");
                        $("input[name='supply_bonus'][value='1']").attr("checked",true);
                    }else if(supply_bonus=='2'){
                        $(".cardL-type").attr("style","display:none");
                        $("input[name='supply_bonus'][value='2']").attr("checked",true);
                    }
                    /*礼品卡详情**/
                    if(is_locations=='1'){

                        $("input[name='base[is_locations]'][value='1']").attr("checked",true);
                    }else if(is_locations=='2'){

                        $("input[name='base[is_locations]'][value='2']").attr("checked",true);
                    }else if(is_locations=='3'){

                        $("input[name='base[is_locations]'][value='3']").attr("checked",true);
                    }
                    $("#prerogative").val(prerogative);
                    $("#description").val(description);
                    $("#service_phone").val(service_phone);
                    $("#notice").val(notice);
                    // console.log(33,is_center);
                     if(is_center=="1"){

                         $("input[name='base[is_center]'][value='1']").attr("checked",true);

                         $("#pay-weixin").addClass("show");
                        $("#swithtype").val(center.center_title);
                         $("#centerbt").val(center.center_title);
                         $(".centerbt-bt").html(center.center_title);
                         $(".centerfbt-bt").html(center.center_sub_title);
                         $("#centerfbt").val(center.center_sub_title);
                         $("#center_url").val(center.center_url);
                         $("#cxcxapptext").val(center.center_app_brand_user_name);
                         $("#cnametext").val(center.center_app_brand_pass);

                     }else if(is_center=="2"){
                         $("input[name='base[is_center]'][value='2']").attr("checked",true);
                         $("#pay-weixin").addClass("hide");

                     }
                     /*自定义入口*/
                    if(is_custom=="1"){

                        $("#self-ipt-3").val(is_custom);
                        $("#ng-scope5").html("已开启");
                        $("#self-3").val(custom_cell1.custom_url_name);
                        $(".cell4-bt").html(custom_cell1.custom_url_name);
                        $(".tit4-bt").html(custom_cell1.custom_url_sub_title);

                        $("#tit4").val(custom_cell1.custom_url_sub_title);
                        $("#centerfbt").val(custom_cell1.custom_url_sub_title);
                        $(".self-3-url").val(custom_cell1.custom_url);
                        $("#app_brand_user_name4").val(custom_cell1.center_app_brand_user_name);
                        $("#app_brand_pass4").val(custom_cell1.center_app_brand_pass);

                    }else if(is_custom=="2"){
                        $("#self-ipt-3").val(is_custom);
                        $("#ng-scope5").html("已关闭");
                        // $("#pay-weixin").addClass("hide").removeClass("show");

                    }
                    /***/
                }
            }
    })
    })
</script>
<script>
    // var date = new Date();
    // //执行一个laydate实例
    // laydate.render({
    //     elem: '#starttime'
    //     ,type: 'datetime'
    //     ,range: true
    //     ,min:data
    // });

    var laydate = laydate;
    var date = new Date();
    var year = parseInt(date.getFullYear());
    var month = parseInt(date.getMonth())+1;
    var day = parseInt(date.getDate());
    var H = parseInt(date.getHours());
    var M =parseInt( date.getMinutes());
    var S = parseInt(date.getSeconds());
    if(month<10){
        month = "0"+month;
    }
    if(day<10){
        day = "0"+day;
    }
    var min = year+"-"+month+"-"+day +" "+ H +':'+ M +':'+S;
    // console.log(min);
    var date = {
        type: 'datetime',
        min:min,
        range:'-',
        trigger: 'click'
    };
    date.elem = '#starttime';
    //执行一个laydate
    laydate.render(date);

</script>
<script>
    $("#date_info").change(function() {
        var val = $(this).val();
        $(".cover2").removeClass("show").addClass("hide");
        if(val == 'DATE_TYPE_FIX_TIME_RANGE') {

            $(".cover1").removeClass("hide").addClass("show");
            $(".cover2").removeClass("show").addClass("hide");

        } else if(val == "DATE_TYPE_FIX_TERM") {
            $(".cover1").removeClass("show").addClass("hide");
            $(".cover2").removeClass("hide").addClass("show");

        }else if(val == "DATE_TYPE_PERMANENT"){
            $(".cover1").removeClass("show").addClass("hide");
            $(".cover2").removeClass("hide").addClass("hide");
        }
    });
</script>
<script>
    var GetLength = function (str) {
        ///<summary>获得字符串实际长度，中文2，英文1</summary>
        ///<param name="str">要获得长度的字符串</param>
        var realLength = 0, len = str.length, charCode = -1;
        for (var i = 0; i < len; i++) {
            charCode = str.charCodeAt(i);
            if (charCode >= 0 && charCode <= 128) realLength += 1;
            else realLength += 2;
        }
        //console.log(realLength);
        return realLength;
    };

    //js截取字符串，中英文都能用
    //如果给定的字符串大于指定长度，截取指定长度返回，否者返回源字符串。
    //字符串，长度

    /**
     * js截取字符串，中英文都能用
     * @param str：需要截取的字符串
     * @param len: 需要截取的长度
     */
    function cutstr(str, len) {
        var str_length = 0;
        var str_len = 0;
        str_cut = new String();
        str_len = str.length;
        for (var i = 0; i < str_len; i++) {
            a = str.charAt(i);
            str_length++;
            if (escape(a).length > 4) {
                //中文字符的长度经编码之后大于4
                str_length++;
            }
            str_cut = str_cut.concat(a);
            //console.log(str_cut);
            if (str_length >= len) {
                //str_cut = str_cut.concat("...");
                return str_cut;
                // console.log(str_cut);
                //console.log(len);
            }
        }
        //如果给定字符串小于指定长度，则返回源字符串；
        if (str_length < len) {
            return str;
        }
    }
    function text(idq,tex,num){

        if (GetLength($("#"+idq).val()) > num) {

            $("#"+idq).val(cutstr($("#"+idq).val(), num));

        }
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)

    };
</script>
<script>


    function tex(idq,tex,num){
        // console.log(idq,tex,num)
        $("#"+tex).text("还可以输入" + (num - $("#"+idq).val().length) + "个字");


        if ( $("#"+idq).val().length > num) {
            $("#"+idq).val( $("#"+idq).val().substring(0, num));
        }
        $("#"+tex).text("还可以输入" + (num -  $("#"+idq).val().length) + "个字");
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)
        // console.log($("#"+idq).val());
    }


</script>
<script>

    function onloaded(){
        var fbt= $("#self-type-ch").find("option:selected").attr("data-fbt");
        var url = $("#self-type-ch").find("option:selected").attr("data-url");
        $("#typetext").val(fbt);
        $("#type-url").val(url);
    }
    $(function () {
        onloaded();

//        监听模态框显示调取门店数据
        $('#myModal').on('show.bs.modal', function () {
            $.ajax({
                url: "{:url('mach/getstorelist')}",
                type: "post",
                success: function (data) {

                    if(data.code==0){
                        var datas = data.list.data;
                        if (datas == "") {
                            $("#tbody").html("<tr><td>暂无门店</td></tr>");
                        } else {
                            var trlist = "";
                            for (var i = 0; i < datas.length; i++) {
                                trlist += "<tr>" +
                                    "<td><div class='checkbox pull-left'><label><input type='checkbox' name='mallcheck' data-id='" + datas[i].mapid + "'>" + datas[i].business_name + "</label></div></td>" +
                                    "<td><div class='checkbox pull-left'><label>" + datas[i].address + "</label></div></td>" +
                                    "</tr>"
                            }
                            $("#tbody").html(trlist);
                        }
                    }else if(data.code==9001){
                        $("#tbody").html("<tr><td>查询失败</td></tr>");
                    }else if(data.code==9002){
                        $("#tbody").html("<tr><td>暂无门店</td></tr>");
                    }
                }
            })
        });
//        选择适用门店模态框数据清空
        $('#myModal').on('hide.bs.modal', function () {
            $("#tbody").html("");
        });
//        选择适用门店完成
        $('#choiceComplate').click(function () {
            var len = $("input[name='mallcheck']").length;
            var checkid = "";
            for (var i = 0; i < len; i++) {
                if ($("input[name='mallcheck']").eq(i).is(':checked')) {
                    var id = $("input[name='mallcheck']").eq(i).attr("data-id");
                    if (checkid == "") {
                        checkid = id;
                    } else {
                        checkid += "," + id;
                    }
                }
            }
            if (checkid == "") {
                layer.alert("请选择门店")
            } else {
                $("#location_id_list").val(checkid);
                $('#myModal').modal("hide");
            }
        });
//        全选
        $("#allchoice").click(function(){
            var t = $(this).is(":checked");
            if(t == true){
                $("input[name='mallcheck']").attr("checked",true);
            }else if(t==false){
                $("input[name='mallcheck']").removeAttr("checked");
            }
        });
        $('#end_time').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
        });
    });

</script>
<script type="text/javascript">
    function upload(file, typed) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other', file);
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            if(res.code=="0"){
                //            左侧预览图背景
                $("." + file).css("backgroundImage", "url(" + res.pic + ")");
//            右侧预览图片
                $("." + file + "-img").attr("src", res.pic);
//            相应隐藏input传值
                $("#" + file + "-upload").val(res.pic);
            }else{
                layer.alert(res.message);
            }

            // $("." + file).attr("src", res.savapath).css("display", "block");
            // $(".file-" + file).val(res.other);
            // $("." + typed + "-" + file).val(res.other);
        }).fail(function (res) {
            alert("上传失败")
        });
    };
    $(function () {
//        选取优惠券背景颜色
        $(".color-list li").click(function () {
            $(".color-list li").removeClass("selected");
            $(this).addClass("selected");
            var colors = $(this).attr("data-color");
            $(".card_section").css("background-color", colors);
            $(".ljsy").css("background-color", colors);
            $("input[name='base[color]']").val(colors);
        });
    })
</script>

<script>
    $("#self-type-ch").change(function(){
        // console.log($(this).val());
        var sval=$(this).val();
        if(sval=="自定义"){

            $(this).siblings("input").prop("type","text");
        }else{
            $(this).siblings("input").prop("type","hidden");
        }

    })
</script>
<script>
    function showinput(id,obj){
        var val=$(obj).val();

        $("."+id+"-bt").text(val);

    }
    function showtitl(id,obj){
        var val=$(obj).val();
        $("."+id+"-bt").text(val);
        $("."+id+"-bt").val(val);

    }
    function showhui(obj){
        var val=$(obj).val();

        $(".hui").text(val);

    }
    function showvice(obj){
        var val=$(obj).val();
        $(".vice").text(val);
    }
</script>
</html>
